import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:get_storage/get_storage.dart';

import 'app/routes/app_pages.dart';
import 'app/routes/app_routes.dart';
import 'app/bindings/initial_binding.dart';
import 'config/themes/theme_manager.dart';
import 'translations/app_translations.dart';

/// 主应用组件
class App extends StatelessWidget {
  const App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      // 应用标题
      title: '海隆HIOT云平台',
      
      // 主题配置
      theme: ThemeManager.to.theme,
      themeMode: ThemeManager.to.themeMode,
      
      // 调试标签
      debugShowCheckedModeBanner: false,
      
      // 路由配置
      initialRoute: AppPages.initial,
      getPages: AppPages.routes,
      
      // 绑定初始依赖
      initialBinding: InitialBinding(),
      
      // 国际化配置
      locale: Get.deviceLocale,
      fallbackLocale: const Locale('zh', 'CN'),
      translations: AppTranslations(),
      
      // 默认转场动画
      defaultTransition: Transition.fade,
      
      // 启用GetX日志
      enableLog: true,
      logWriterCallback: (text, {bool isError = false}) {
        debugPrint('GetX: ${isError ? 'ERROR: ' : ''}$text');
      },
    );
  }
} 